# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=hidrd
pkgver=0.2.0_git20190603
pkgrel=0
_commit=6c0ed39708a5777ac620f902f39c8a0e03eefe4e
pkgdesc="HID report descriptor I/O library and conversion tool"
url="https://github.com/DIGImend/hidrd"
arch="all"
license="GPL-2.0-or-later"
makedepends="automake autoconf libtool musl-obstack-dev m4"
checkdepends="bash coreutils linux-headers"
subpackages="$pkgname-dev"
# source="https://github.com/DIGImend/hidrd/releases/download/$pkgver/hidrd-$pkgver.tar.gz
source="$pkgname-$pkgver.tar.gz::https://github.com/DIGImend/hidrd/archive/$_commit.tar.gz
	musl-fix-headers.patch
	fix-check.patch
	"
builddir="$srcdir/$pkgname-$_commit"

prepare() {
	default_prepare
	autoreconf -vfi
}

build() {
	LIBS=-lobstack \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="baffd4a300e78a95c340a845d038aa71722ff21e5f6e8776db74d360da72e0fcfba68ac821085e45b6176b13b91771368501296cc126ce4662b738a567dba415  hidrd-0.2.0_git20190603.tar.gz
36bdfedbb49934ca8cf0df0bf31ff386142af53f66494f6af475c06716ab246b39c7a5d211fb3049eddcf64f16ac76452b4a8136dce3604d47c26600d290adb1  musl-fix-headers.patch
5f4f1996b4e4f2009d9ca9c84bb18eb96c0f2aedd1a0f5f948ea741f31fc3e5f96ab82471756b8535e492b4ee365b5b195c91f4cd1cbcb8e6787cab46d9179ce  fix-check.patch"
